{include file="header.html"}
<body>

<div class="navBar">
	<a class="left" href="wap.php?app=member&act=index"><i class="return"></i></a>
	<div class="titleView">下单成功</div>
</div>

<div class="cart-pay main-top">
	<i></i>
	<div class="tip">恭喜您，下单成功！</div>
	<div class="font">我们将很快为您派送</div>
	<!--
	<ul>
		<li class="ge-bottom"><div class="ge-right">应付款</div><span class="r">￥{number_format($total_price,2)}</span></li>
		<li><div class="ge-right">支付方式</div><span>{$pay_method_name}</span></li>
	</ul>
	-->
	<div class="buttonView">
		<a class="btn" href="wap.php?app=member&act=index">返回会员中心</a>
		<a class="wx" href="javascript:callpay()">微信支付</a>
	</div>
</div>

{include file="footer.html"}
<script>
//调用微信JS api 支付
function jsApiCall(){
	WeixinJSBridge.invoke(
		'getBrandWCPayRequest',
		{$data},
		function(res){
			WeixinJSBridge.log(res.err_msg);
			if(res.err_msg=='get_brand_wcpay_request:ok'){
				location.href = 'wap.php?app=cart&act=order_complete&order_sn={$order_sn}';
			}else{
				//alert('支付失败， 原因：\n'+res.err_desc);
				$('.cart-pay a.wx').html('重新支付');
			}
		}
	);
}

function callpay(){
	if (typeof WeixinJSBridge == "undefined"){
		if( document.addEventListener ){
			document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
		}else if (document.attachEvent){
			document.attachEvent('WeixinJSBridgeReady', jsApiCall);
			document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
		}
	}else{
		jsApiCall();
	}
}

$(function(){
	$('.r').priceFont('bigPrice');
	callpay();
});
</script>